package com.qiaoanju.web.controller;

import com.qiaoanju.back.domain.system.MenuModel;
import com.qiaoanju.back.service.system.IMenuService;
import com.qiaoanju.back.service.system.IUserService;
import com.qiaoanju.commons.constants.SessionConstant;
import com.qiaoanju.web.security.service.LoginUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by zhangchong
 * on 2017/9/21.
 */
@Controller
@RequestMapping("/login")
public class loginController extends BaseController{


    @Autowired
    private IUserService userService ;

    @Autowired
    private IMenuService menuService ;


    @RequestMapping(value = "/togo", method = { RequestMethod.GET })
    public String togo(Model model, HttpServletRequest request,
                       HttpServletResponse response) throws Exception {


        return "login";

    }

    @RequestMapping(value = "/login", method = { RequestMethod.GET })
    public String login(Model model, HttpServletRequest request,
                        HttpServletResponse response) throws Exception {

        return "login";

    }

    @RequestMapping(value = "/index", method = { RequestMethod.GET })
    public String index(Model model, HttpServletRequest request,
                        HttpServletResponse response){
        //获取登录用户的信息
        model.addAttribute(SessionConstant.SESSION_USER,LoginUserService.getLoginUser());

        return "welcome";
    }
}
